<!--
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				TimeSheetMaintenance.jsp
  //	TITLE:				TimeSheet Maintenance
  //	FUNCTION:			input TimeSheet.
  //	BY:					Jet Tao
  //	DATE:				11/12/2003
  // UPDATE BY:			Beyes Xia
  //	UPDATE DATE:			2004-1-9
  //	LAST UPDATE DATE:		2004-2-9 8:54
  // --------------------------------------------------------------
-->
<%@ include file="../tssheader.jsp" %>
<%@ page import="tss.timesheet.*" %>
<%@ page import="tss.options.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%
try
{
	ProjectOptions ProjectOption=new ProjectOptions();
	JobOptions JobOption=new JobOptions();

	ChangeNum chgNum=new ChangeNum();

	Vector time_sheet=(Vector)request.getAttribute("TimeSheet");
	String staff_no=(String)request.getAttribute("StaffNo");
//****** Add By Beyes Xia
     String staff_name=(String)request.getAttribute("StaffName");
//******
	String position=(String)request.getAttribute("Grade");
	String start_date=(String)request.getAttribute("StartDate");
	String before_date=(String)request.getAttribute("before_date");
	String last_date=(String)request.getAttribute("last_date");
	String last_flag=(String)request.getAttribute("last_flag");
	String next_flag=(String)request.getAttribute("next_flag");
	String[] a_week=(String[])request.getAttribute("AWeek");
	int t_s_size=0;
	if(time_sheet!=null)
		t_s_size=time_sheet.size();
	float[] total_hours=new float[7];
	for(int i=0;i<total_hours.length;i++)
	{
		total_hours[i]=0;
	}
    SimpleDateFormat sdf1 = new SimpleDateFormat("dd MMM yyyy",Locale.US);
    SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
	for(int i=0;i<a_week.length;i++)
	{
		a_week[i]=sdf1.format(sdf2.parse(a_week[i]));
	}
%>

<SCRIPT Language="Javascript" SRC="<%=contextPath%>/tss/timesheet/Calendar1-821.js"></script>
<script language="JavaScript1.1">
function GoToDate()
{

	if (checkDate(fm.go_to_date)) 
	{
		before=getIntDate("<%=before_date%>");
		last=getIntDate("<%=last_date%>");
		now=getIntDate(fm.go_to_date.value);
		
		if((now>=before)&&(now<last))
		{
			fm.which_week.value=3;
			fm.operation_type.value="edit";
			fm.submit();
		}
		else
			alert("The date should be between <%=before_date%> and <%=last_date%>.");
	}
	else
	{
		alert("Please input correct date with format as YYYY-MM-DD.");
	}

}
function getIntDate(date)
{
	var temp=date.substring(0,4)+date.substring(5,7)+date.substring(8,10);
	return parseInt(temp,10)
}
function tss_calendar()
{
   var today = new Date();
   show_calendar('fm.go_to_date', today.getMonth(), today.getYear(), 'YYYY-MM-DD');
}
 function checkDate(object) {
    var obj=object;
    var d = obj.value;
    if (obj.value==null||obj.value.length==0) 
	{
		alert("Please input correct date with format as YYYY-MM-DD.");
		return false;
	}
    if (obj.value!=null && obj.value.length!=10) 
	{
       alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }
    if (d.substring(4,5)!="-" || d.substring(7,8)!="-") {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }
    var day = d.substring(8,10);
    var month = d.substring(5,7);
    var year = d.substring(0,4);
    if (day==null || isNaN(day)) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }
    if (month==null || isNaN(month)) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }
    if (day==null || isNaN(day)) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }
    if (day < 1 || day > 31) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }

    if (month < 1 || month > 12) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }

    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
    }

    if (month == 2) {
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day > 29 || (day==29 && !isleap)) {
		alert("Please input correct date with format as YYYY-MM-DD.");
       return false;
        }
    }
    return true;
 }
</script>

<html>
<script language="JavaScript1.1">
function autoFill(object)
{
	var num=object.value;
  	object.value=getRightNum(num,2,"Hours ");  
	if(object.value=="")
	{
		setTotal();
		return;
	}
	else
	{
		if((parseFloat(object.value)>24)||(parseFloat(object.value)<=0))
		{
			alert("The Hours must small than 24, and large than 0.");
			object.value="";
			setTotal();
			return;
		}
		setTotal();
	}
}
//Add By Beyes Xia
/*
function mySubmit()
{
	checkboxValue();
	if(check_overtime() && check_recordExist())
	{
		save();
	}
}
function checkboxValue()
{
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
	if(fm.overtime[i].checked)
		fm.otvalue[i].value='Y';
	else
		fm.otvalue[i].value='N';
	}
}
*/
//
function setTotal()
{
	sun_total=0;
	mon_total=0;
	tue_total=0;
	wed_total=0;
	thu_total=0;
	fri_total=0;
	sat_total=0;
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		if(fm.enable_flag[i].value=="1")
		{
			sun_total+=(fm.sun[i].value=="")?0:parseFloat(fm.sun[i].value);
			mon_total+=(fm.mon[i].value=="")?0:parseFloat(fm.mon[i].value);
			tue_total+=(fm.tue[i].value=="")?0:parseFloat(fm.tue[i].value);
			wed_total+=(fm.wed[i].value=="")?0:parseFloat(fm.wed[i].value);
			thu_total+=(fm.thu[i].value=="")?0:parseFloat(fm.thu[i].value);
			fri_total+=(fm.fri[i].value=="")?0:parseFloat(fm.fri[i].value);
			sat_total+=(fm.sat[i].value=="")?0:parseFloat(fm.sat[i].value);
		}
	}
	
	fm.sun_total.value=sun_total;
	fm.mon_total.value=mon_total;
	fm.tue_total.value=tue_total;
	fm.wed_total.value=wed_total;
	fm.thu_total.value=thu_total;
	fm.fri_total.value=fri_total;
	fm.sat_total.value=sat_total;
	
	fm.sun_total.value=getRightNum(fm.sun_total.value,2,"Hours ");
	fm.mon_total.value=getRightNum(fm.mon_total.value,2,"Hours ");
	fm.tue_total.value=getRightNum(fm.tue_total.value,2,"Hours ");
	fm.wed_total.value=getRightNum(fm.wed_total.value,2,"Hours ");
	fm.thu_total.value=getRightNum(fm.thu_total.value,2,"Hours ");
	fm.fri_total.value=getRightNum(fm.fri_total.value,2,"Hours ");
	fm.sat_total.value=getRightNum(fm.sat_total.value,2,"Hours ");

}
function thisweek()
{
   var today = new Date();
   month=(today.getMonth()+1>9)?(today.getMonth()+1):"0"+(today.getMonth()+1);
   date=(today.getDate()>9)?today.getDate():("0"+today.getDate());
   fm.selected_date.value=today.getYear()+"-"+month+"-"+date;
   fm.which_week.value=1;
	fm.operation_type.value="edit";
	fm.submit();
}
function lastweek()
{
   fm.which_week.value=0;
	fm.operation_type.value="edit";
	fm.submit();
}
function nextweek()
{
   fm.which_week.value=2;
	fm.operation_type.value="edit";
	fm.submit();
}

function myreset()
{
	fm.go_to_date.value='';
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		fm.sun[i].value='';
		fm.mon[i].value='';
		fm.tue[i].value='';
		fm.wed[i].value='';
		fm.thu[i].value='';
		fm.fri[i].value='';
		fm.sat[i].value='';
		fm.sun[i].disabled=true;
		fm.mon[i].disabled=true;
		fm.tue[i].disabled=true;
		fm.wed[i].disabled=true;
		fm.thu[i].disabled=true;
		fm.fri[i].disabled=true;
		fm.sat[i].disabled=true;
		fm.project[i].value='';
		fm.job[i].value='';
	}
	setTotal();
}

function DoOnChange()
{
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		if((fm.job[i].value=="") || (fm.project[i].value==""))
		{
			fm.enable_flag[i].value="0";
			fm.sun[i].disabled=true;
			fm.mon[i].disabled=true;
			fm.tue[i].disabled=true;
			fm.wed[i].disabled=true;
			fm.thu[i].disabled=true;
			fm.fri[i].disabled=true;
			fm.sat[i].disabled=true;
//			fm.overtime[i].disabled=true;	// Add By Beyes Xia
		}
		else
		{
			fm.enable_flag[i].value="1";
			fm.sun[i].disabled=false;
			fm.mon[i].disabled=false;
			fm.tue[i].disabled=false;
			fm.wed[i].disabled=false;
			fm.thu[i].disabled=false;
			fm.fri[i].disabled=false;
			fm.sat[i].disabled=false;
//			fm.overtime[i].disabled=false;	// Add By Beyes Xia
		}
	}
	setTotal();
}
function init()
{
   var today = new Date();
   month=(today.getMonth()+1>9)?(today.getMonth()+1):"0"+(today.getMonth()+1);
   date=(today.getDate()>9)?today.getDate():("0"+today.getDate());
   fm.now_date.value=today.getYear()+"-"+month+"-"+date;	
	fm.go_to_date.value=fm.now_date.value;
	fm.last_week.disabled=<%=last_flag%>;
	fm.next_week.disabled=<%=next_flag%>;
	
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		if(fm.enable_flag[i].value=="0")
		{
			fm.sun[i].disabled=true;
			fm.mon[i].disabled=true;
			fm.tue[i].disabled=true;
			fm.wed[i].disabled=true;
			fm.thu[i].disabled=true;
			fm.fri[i].disabled=true;
			fm.sat[i].disabled=true;
//			fm.overtime[i].disabled=true;	// Add By Beyes Xia
		}
	}
}
function formValidation()
{
	kickNull();
	if(!check_total())
		return false;
	fm.operation_type.value="save";
	return true;
}
function check_total()//the total must equal to 0 or 8.
{
        return true;

	if(fm.sun_total.value != 0)
	{
		alert("Total hours of Sunday must equal to 0.");
		return false;
	}
	if(fm.mon_total.value != 0 && fm.mon_total.value != 8)
	{
		alert("Total hours of Monday must equal to 0 or 8.");
		return false;
	}
	if(fm.tue_total.value != 0 && fm.tue_total.value != 8)
	{
		alert("Total hours of Tuesday must equal to 0 or 8.");
		return false;
	}
	if(fm.wed_total.value != 0 && fm.wed_total.value != 8)
	{
		alert("Total hours of Wednesday must equal to 0 or 8.");
		return false;
	}
	if(fm.thu_total.value != 0 && fm.thu_total.value != 8)
	{
		alert("Total hours of Thursday must equal to 0 or 8.");
		return false;
	}
	if(fm.fri_total.value != 0 && fm.fri_total.value != 8)
	{
		alert("Total hours of Friday must equal to 0 or 8.");
		return false;
	}
	if(fm.sat_total.value != 0)
	{
		alert("Total hours of Saturday must equal to 0.");
		return false;
	}
	return true;
}

//****** Add By Beyes Xia
/*
function check_overtime()
{
	sun_overtime = 0;
	mon_overtime = 0;
	tue_overtime = 0;
	wed_overtime = 0;
	thu_overtime = 0;
	fri_overtime = 0;
	sat_overtime = 0;
	
	sun_jobtime = 0;
	mon_jobtime = 0;
	tue_jobtime = 0;
	wed_jobtime = 0;
	thu_jobtime = 0;
	fri_jobtime = 0;
	sat_jobtime = 0;
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		if(fm.enable_flag[i].value=="1" && fm.otvalue[i].value=="Y")
		{
			sun_overtime+=(fm.sun[i].value=="")?0:parseFloat(fm.sun[i].value);
			mon_overtime+=(fm.mon[i].value=="")?0:parseFloat(fm.mon[i].value);
			tue_overtime+=(fm.tue[i].value=="")?0:parseFloat(fm.tue[i].value);
			wed_overtime+=(fm.wed[i].value=="")?0:parseFloat(fm.wed[i].value);
			thu_overtime+=(fm.thu[i].value=="")?0:parseFloat(fm.thu[i].value);
			fri_overtime+=(fm.fri[i].value=="")?0:parseFloat(fm.fri[i].value);
			sat_overtime+=(fm.sat[i].value=="")?0:parseFloat(fm.sat[i].value);
		}
		if(fm.enable_flag[i].value=="1" && fm.otvalue[i].value=="N")
		{
			sun_jobtime+=(fm.sun[i].value=="")?0:parseFloat(fm.sun[i].value);
			mon_jobtime+=(fm.mon[i].value=="")?0:parseFloat(fm.mon[i].value);
			tue_jobtime+=(fm.tue[i].value=="")?0:parseFloat(fm.tue[i].value);
			wed_jobtime+=(fm.wed[i].value=="")?0:parseFloat(fm.wed[i].value);
			thu_jobtime+=(fm.thu[i].value=="")?0:parseFloat(fm.thu[i].value);
			fri_jobtime+=(fm.fri[i].value=="")?0:parseFloat(fm.fri[i].value);
			sat_jobtime+=(fm.sat[i].value=="")?0:parseFloat(fm.sat[i].value);
		}
	}
	alert('sun_overtime ='+sun_overtime+'\n'+ 
		 'mon_overtime ='+mon_overtime+'\n'+
		 'tue_overtime ='+tue_overtime+'\n'+
	      'wed_overtime ='+wed_overtime+'\n'+
	      'thu_overtime ='+thu_overtime+'\n'+
	      'fri_overtime ='+fri_overtime+'\n'+
	      'sat_overtime ='+sat_overtime+'\n'+
	
		 'sun_jobtime ='+sun_jobtime+'\n'+
		 'mon_jobtime ='+mon_jobtime+'\n'+
		 'tue_jobtime ='+tue_jobtime+'\n'+
		 'wed_jobtime ='+wed_jobtime+'\n'+
		 'thu_jobtime ='+thu_jobtime+'\n'+
		 'fri_jobtime ='+fri_jobtime+'\n'+
		 'sat_jobtime ='+sat_jobtime);			
//check Overtime
	if(mon_overtime > 16)
	{
		alert("Over Time Work hours of Monday can't over 16.");
		return false;
	}
	if(tue_overtime > 16)
	{
		alert("Over Time Work hours of Tuesday can't over 16.");
		return false;
	}
	if(wed_overtime > 16)
	{
		alert("Over Time Work hours of Wednesday can't over 16.");
		return false;
	}
	if(thu_overtime > 16)
	{
		alert("Over Time Work hours of Thursday can't over 16.");
		return false;
	}
	if(fri_overtime > 16)
	{
		alert("Over Time Work hours of Friday can't over 16.");
		return false;
	}
	if(sat_overtime > 24)
	{
		alert("Over Time Work hours of Saturday can't over 24.");
		return false;
	}
	if(sun_overtime > 24)
	{
		alert("Over Time Work hours of Sunday can't over 24.");
		return false;
	}
//check Normal time
	if(mon_jobtime > 8)
	{
		alert("Normal Time Work hours of Monday can't over 8.");
		return false;
	}
	if(tue_jobtime > 8)
	{
		alert("Normal Time Work hours of Tuesday can't over 8.");
		return false;
	}
	
	if(wed_jobtime > 8)
	{
		alert("Normal Time Work hours of Wednesday can't over 8.");
		return false;
	}
	if(thu_jobtime > 8)
	{
		alert("Normal Time Work hours of Thursday can't over 8.");
		return false;
	}
	if(fri_jobtime > 8)
	{
		alert("Normal Time Work hours of Friday can't over 8.");
		return false;
	}
	if(sat_jobtime > 0)
	{
		alert("Normal Time Work hours of Saturday can't over 0.");
		return false;
	}
	if(sun_jobtime > 0)
	{
		alert("Normal Time Work hours of Sunday can't over 0.");
		return false;
	}
	return true;
}
function check_recordExist()
{
	var pjo = new Array(5+<%=t_s_size%>);
	for(i=0;i<5+<%=t_s_size%>;i++)
	{	
		if(fm.enable_flag[i].value=="1")
		pjo[i] =fm.project[i].value+fm.job[i].value+fm.otvalue[i].value;
	}
	for(j=0;j<5+<%=t_s_size%>;j++)
	{
		for(k=5+<%=t_s_size%>-1;k>j;k--)
		{

			if(pjo[j]==pjo[k] && pjo[j]!=undefined && pjo[k]!=undefined)
			{

				alert('The '+(j+1)+' record is the same as the '+(k+1)+' record.');
				return false;
			}
		}
	}
	return true;
}
*/	
//******
function kickNull()//kill those do not have data(it's "hours") from "sun" to "sat".
{
	total_record=0;
	for(i=0;i<5+<%=t_s_size%>;i++)
	{
		if(fm.enable_flag[i].value=="1")
		{
		total_record++;			
		if((fm.sun[i].value=="")&&(fm.mon[i].value=="")&&(fm.tue[i].value=="")&&(fm.wed[i].value=="")&&(fm.thu[i].value=="")&&(fm.fri[i].value=="")&&(fm.sat[i].value==""))
			{
				total_record--;
				fm.job[i].value="";
				fm.project[i].value="";
				fm.enable_flag[i].value="0";
//				fm.overtime[i].disabled=true;
				fm.sun[i].disabled=true;
				fm.mon[i].disabled=true;
				fm.tue[i].disabled=true;
				fm.wed[i].disabled=true;
				fm.thu[i].disabled=true;
				fm.fri[i].disabled=true;
				fm.sat[i].disabled=true;
			}
		}
	}
	fm.total_record.value=total_record;
}
</script>

<body onload='init()'>
<h2>Time Sheet Maintenance</h2>
<form id=fm method=post action='<%=contextPath%>/servlet/tss.timesheet.TimeSheetInput' >

<input type=hidden name='selected_date' value=<%=start_date%>>
<input type=hidden name='now_date' value=''>
<input type=hidden name='which_week'>
<input type=hidden name='operation_type' value="edit">
<input type=hidden name='total_record' value="0">

<table>
<tr>
<td>Staff No.</td>
<td><input type=text name='staff_no' value='<%=staff_no%>' class=read readonly ></td>
<!-- Add By Beyes Xia -->
<td>&nbsp;Staff Name</td>
<td><input type=text name='staff_name' value='<%=staff_name%>' class=read readonly ></td>
</tr>
<tr>
<!-- ---------------- -->
<td>Position</td>
<td><input type=text name='position' value='<%=position%>' class=read readonly ></td>
<td>&nbsp;Start Date</td>
<td><input type=text value='<%=start_date%>' class=read readonly ></td>
</tr>
</table>
<p>
<table cols=2 border=1 >
<thead>
<td nowrap style='WIDTH:15%'><b><br><br>Project</b></td>
<td nowrap style='WIDTH:15%'><b><br><br>Job</b></td>
<!-- Add By Beyes Xia -->
<!--	2004-4-20 9:33
<td nowrap style='WIDTH:10%'><b><br><br>Over Time</b></td>
-->
<!-- ---------------- -->
<td nowrap style='WIDTH:9%'><b>Sun<br><%=a_week[0].substring(3,6)%><br><%=a_week[0].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Mon<br><%=a_week[1].substring(3,6)%><br><%=a_week[1].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Tue<br><%=a_week[2].substring(3,6)%><br><%=a_week[2].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Wed<br><%=a_week[3].substring(3,6)%><br><%=a_week[3].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Thu<br><%=a_week[4].substring(3,6)%><br><%=a_week[4].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Fri<br><%=a_week[5].substring(3,6)%><br><%=a_week[5].substring(0,2)%></b></td>
<td nowrap style='WIDTH:9%'><b>Sat<br><%=a_week[6].substring(3,6)%><br><%=a_week[6].substring(0,2)%></b></td>
</thead>
<%
	if(time_sheet!=null)
	{
		int size=time_sheet.size();
		for(int i=0;i<size;i++)
		{
			String[] time_sheet_str=(String[])time_sheet.get(i);
			total_hours[0]+=(time_sheet_str[2].equals("")?0:Float.parseFloat(time_sheet_str[2]));
			total_hours[1]+=(time_sheet_str[3].equals("")?0:Float.parseFloat(time_sheet_str[3]));
			total_hours[2]+=(time_sheet_str[4].equals("")?0:Float.parseFloat(time_sheet_str[4]));
			total_hours[3]+=(time_sheet_str[5].equals("")?0:Float.parseFloat(time_sheet_str[5]));
			total_hours[4]+=(time_sheet_str[6].equals("")?0:Float.parseFloat(time_sheet_str[6]));
			total_hours[5]+=(time_sheet_str[7].equals("")?0:Float.parseFloat(time_sheet_str[7]));
			total_hours[6]+=(time_sheet_str[8].equals("")?0:Float.parseFloat(time_sheet_str[8]));
%>
<tr>
  <td>
    <select name=project onchange='DoOnChange()'>
	<%=ProjectOption.getDefualtOptions(staff_no,time_sheet_str[0])%>
    </select>
  </td>
  <td>
    <select name=job onchange='DoOnChange()'>
       <%=JobOption.getOptions(time_sheet_str[1])%>
	</select>
  </td>
<!-- Add By Beyes Xia -->
<!--	2004-4-20 9:34
<td align=center><input type=checkbox name='overtime' class=btn <%=time_sheet_str[9].equals("Y")?"checked":""%> disabled></td>
<input type=hidden name='otvalue' value='<%=time_sheet_str[9]%>'>
-->
<!-- ---------------- -->
<td><INPUT type=text name='sun' value='<%=chgNum.getFixNum(time_sheet_str[2],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='mon' value='<%=chgNum.getFixNum(time_sheet_str[3],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='tue' value='<%=chgNum.getFixNum(time_sheet_str[4],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='wed' value='<%=chgNum.getFixNum(time_sheet_str[5],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='thu' value='<%=chgNum.getFixNum(time_sheet_str[6],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='fri' value='<%=chgNum.getFixNum(time_sheet_str[7],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
<td><INPUT type=text name='sat' value='<%=chgNum.getFixNum(time_sheet_str[8],2)%>'  onBlur="autoFill(this);"     maxlength=5 size=6></td>
</tr>
<input type=hidden name='enable_flag' value='1'>

<%
		}
	}
%>
<%
	for(int i=0;i<5;i++)
	{
%>
<tr>
  <td>
    <select name=project  onchange='DoOnChange()'>
	<%=ProjectOption.getDefualtOptions(staff_no,"")%>
	</select>
  </td>
  <td>
    <select name=job  onchange='DoOnChange()'>
       <%=JobOption.getOptions("")%>
	</select>
  </td>
<!-- Add By Beyes Xia -->
<!--	2004-4-20 9:34
<td  align=center><input type=checkbox name='overtime' class=btn ></td>
<input type=hidden name='otvalue' value='N'>
-->
<!-- ---------------- -->
<td><INPUT type=text name='sun' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='mon' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='tue' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='wed' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='thu' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='fri' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
<td><INPUT type=text name='sat' value=''  onBlur="autoFill(this);"    maxlength=5 size=6></td>
</tr>
<input type=hidden name='enable_flag' value='0'>

<%
	}
%>
<tr>
<td colspan=2>Total(hours)</td>
<td><INPUT type=text name='sun_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[0]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='mon_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[1]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='tue_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[2]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='wed_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[3]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='thu_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[4]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='fri_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[5]),2)%>'  maxlength=5 size=6 class=read readonly></td>
<td><INPUT type=text name='sat_total' value='<%=chgNum.getFixNum(String.valueOf(total_hours[6]),2)%>'  maxlength=5 size=6 class=read readonly></td>
</tr>

</table>
<br>
<hr>
<p>
<!-- update by Beyes Xia -->
  <INPUT type=button value='Save' onclick='save()' >
<!-- ---------------------->
  <INPUT type=button name='last_week' value='Last Week' onclick='lastweek()'>
  <INPUT type=button name='next_week' value='Next Week' onclick='nextweek()'>
  <INPUT type=button name='this_week' value='This Week' onclick='thisweek()'>
  <INPUT type=button  value='Cancel' onclick='myreset()'>
</p>
  <INPUT type=button name='go_to' value='GO TO' onclick='GoToDate()'>
 <input type=text name='go_to_date' maxlength=10  ALIGN='LEFT' onBlur='checkDate(this)'>
      <input type=button name=but_cal onClick="tss_calendar();" value='...'><font color=#ffffff>(YYYY-MM-DD)</font>
</form>
<h4>Note: Before you want to change page using button "Last Week", "Next Week" or "This Week", 
	please press the "Save" button to save the data you inputted.</h4>
<%@ include file="../tssfooter.jsp" %>
</body>
</html>
<%
	System.out.println("no found exception in jsp.");
	}
catch(Exception e)
	{
		e.printStackTrace();
	}
	
%>
